package com.dongdongshop.serviec.seller;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.seller.TbSellerMapper;
import com.dongdongshop.pojo.seller.TbSeller;
import com.dongdongshop.service.SellerService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Service
public class SellerServicImpl implements SellerService {
    @Resource
    private TbSellerMapper tbSellerMapper;

    @Override
    public String getNameById(String sellerId) {
        return tbSellerMapper.selectNameBySellerId(sellerId);
    }

    @Override
    public int update(String sellerId,String status) {
        TbSeller seller=new TbSeller();
        seller.setSellerId(sellerId);
        seller.setStatus(status);
      return   tbSellerMapper.updateByPrimaryKeySelective(seller);
    }

    @Override
    public TbSeller selectById(String sellerId) {
        return tbSellerMapper.selectByPrimaryKey(sellerId);
    }

    @Override
    public List<TbSeller> listSeller(String name, String nickName) {
        return tbSellerMapper.listSeller(name,nickName);
    }

    @Override
    public void toRegister(TbSeller tbSeller) {
        tbSellerMapper.insertSelective(tbSeller);
    }

    @Override
    public TbSeller findName(String id) {
        return tbSellerMapper.selectByPrimaryKey(id);
    }
}
